<?php
ob_start();
@include_once('include/common.inc.php');	
//@include('logincleck.php');
$id = $_GET['id'];
$search = $_GET['search'];

/**************浏览的cookie*******************/
$Cookie_7 = $_COOKIE['Cookie_7_Id'];
$Array_7 = explode(',',$Cookie_7);
if(!empty($Cookie_7))
{
	if(!in_array($id,$Array_7))
	{
		$Cookie_7 = $id.','.$Cookie_7;
	}
}else{
	$Cookie_7 = $id;
}
setcookie("Cookie_7_Id", $Cookie_7, time()+86400*7); /* 有效期7天 */ 
/*********************************/


/************Search的cookie*********************/
$Cookie_5 = $_COOKIE['Cookie_5_Id'];
$Array_5 = explode(',',$Cookie_5);
if(!empty($Cookie_5)&$search=='on')
{
	if(!in_array($id,$Array_5))
	{
		$Cookie_5 = $id.','.$Cookie_5;
	}
}else if($search=='on'){
	$Cookie_5 = $id;
}
setcookie("Cookie_5_Id", $Cookie_5, time()+86400*5); /* 有效期5天 */ 
/*********************************/

$query = "select * from $TBL_HOUSE where id =$id";
$result = mysql_query($query);
$row2 = mysql_fetch_array($result);

$sel_lease = "select * from $TBL_LEASE where hou_num=".$row2['num'];
$res_lease = mysql_query($sel_lease);
$rows_lease = @mysql_fetch_array($res_lease);

$sel_store = "select * from $TBL_STORE where id=".$rows_lease['store'];	
$res_store = mysql_query($sel_store);
$rows_store = @mysql_fetch_array($res_store);
if($rows_lease['id']!='')
{
	if($rows_lease['state']==0)
	{	
		$lease_show = "已收定金，日期：".substr($rows_lease['addtime'],0,10)."，".$rows_store['name'];
	}else{
		$lease_show = "已經簽約，日期：".substr($rows_lease['addtime'],0,10)."，".$rows_store['name'];
	}
}
$store_id = $row2['store'];
$store = "select * from $TBL_STORE where id=$store_id";
$s_result = mysql_query($store);
$s_row = @mysql_fetch_array($s_result);
$row2['store_name'] = $s_row['name'];
$row2['store_tel'] = $s_row['tel'];
$row2['store_addr'] = $s_row['addr'];
$row2['store_contact'] = $s_row['contact'];
$row2['ADDR'] = $row2[cate_name].$row2[address];
$row[]=$row2;	
$hou_type = $row2['hou_type'];
$hit2 = $row2['hit'] + 1;
mysql_query("update $TBL_HOUSE set hit =$hit2 where id=$id");//更新刷新
@include('number.php');//验证码
$smarty->assign("row",$row);
$smarty->assign("rowadv",$rowadv);
$smarty->assign("hou_type",$hou_type);
$smarty->assign("lease_show",$lease_show);
$smarty->display('goods.html',$id);
?>